home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / asm_n_z.zip / NOBOOT.ASM < prev    next >
Assembly Source File  |  1986-03-03  |  7KB  |  169 lines

  1.  
  2.         page 64,132
  3.         title NOBOOT - disables <Ctrl><Alt><Del> reset sequence
  4.         subttl Steve Harrison Systems n Software
  5.         ;
  6.         ;
  7. comment *
  8.  
  9.         Documentation for NOBOOT:
  10.         --------------------------
  11.  
  12.         This program disables the <Ctrl><Alt><Del> keyboard reset
  13.         sequence. Once this program is installed, the only way to
  14.         reboot the system is to turn the power off and then back
  15.         on.
  16.  
  17.         This program is adapted from Personal Computer Age
  18.         magazine Volume 2.4, pp 17-21.  The original version
  19.         referenced absolute addresses in ROM, which limits
  20.         portability to other machines or even to an XT.
  21.         This version overcomes these restrictions, but adds
  22.         the requirement that DOS 2.0 or greater be used.
  23.         This program will not work with DOS 1.0 or 1.1.
  24.         By necessity, one reference to an absolute memory
  25.         address is made -- to KB_FLAG at 0040:0017h.  If your
  26.         machine uses a different address, change the one line
  27.         noted below to suit your machine.
  28.  
  29.         This program need be run only once. Although running it
  30.         multiple times will cause no real harm, it could slow
  31.         things down a bit.  In the interest of simplicity, no
  32.         attempt is made to determine whether or not the "filter"
  33.         is already installed -- it blindly installs itself as
  34.         many times as you tell it to.  It is suggested that you
  35.         execute this program from your AUTOEXEC.BAT file.
  36.  
  37.         Every time a key is pressed or released, the resident
  38.         portion of this program checks to see if the <Ctrl> and
  39.         <Alt> keys are both depressed.  If they are, it tells BIOS
  40.         that they are not.  In effect, it "filters out" this
  41.         key sequence.  This means that any program that
  42.         requires you to make a keyboard entry like
  43.                 <Ctrl><Alt><anything else>
  44.         will no longer function because the system will be fooled
  45.         into thinking that the <Ctrl> and <Alt> keys are not
  46.         depressed.
  47.  
  48.         There is one known analomy [that's a nice way of saying "bug"]
  49.         in this program.  Consider the case where the user depresses
  50.         both the <Ctrl> and the <Alt> keys and then releases the
  51.         <Ctrl> key, leaving only the <Alt> key depressed.  Normally,
  52.         the ALT_SHIFT bit in KB_FLAG would be on.  With this program
  53.         installed, it will be off.  This means that the user must
  54.         release the <Alt> key and depress it AGAIN before it will
  55.         be recognized by the system.  A similar situation occurs
  56.         for releasing the <Alt> key while leaving the <Ctrl> key
  57.         depressed.  This analomy can be corrected with a bit of
  58.         creative programming but is not dealt with here in the
  59.         interest of simplicity.
  60.  
  61.         Feel free to modify, mutilate, or adulterate this program.
  62.         If you come up with an bug or improvement, please let me
  63.         know by writing me at this address:
  64.                 Steve Harrison
  65.                 3203 McKinley St.
  66.                 San Diego,   Ca     92104 
  67.  
  68.         *
  69.         subttl Equates
  70.         page
  71.         ;
  72.         ;
  73.         ;  Equates
  74.         ;
  75.         ;
  76. cr      equ     0dh             ;ASCII carriage return
  77. lf      equ     0ah             ;ASCII line feed
  78. dollar  equ     '$'             ;ASCII dollar sign - string terminator
  79. alt_shift equ   08h             ;bit of kb_flag that means <Alt>  key pressed
  80. ctl_shift equ   04h             ;bit of kb_flag that means <Ctrl> key pressed
  81. alloff  equ     0ffh-alt_shift-ctl_shift ;kb_flag with <Ctrl> and <Alt> bits off
  82.         subttl Segment declarations
  83.         page
  84.         ;
  85.         ;
  86.         ; Segment declarations
  87.         ;
  88.         ;
  89. biosseg segment at 40h
  90.         org     $+17h           ;KB_FLAG is at 0040:0017 for the PC
  91. kb_flag label   byte            ;*** change as appropriate for your machine ***
  92. biosseg ends
  93.         ;
  94.         ;
  95. cseg    segment para public 'code'
  96.         assume  cs:cseg, ds:cseg, ss:nothing, es:cseg
  97.         org     100h            ;for .COM file
  98. entry   label   far
  99.         jmp     short start     ;jump to install routine
  100. oldoff  dw      ?               ;offset  of old INT 9h handler
  101. oldseg  dw      ?               ;segment of old INT 9h handler
  102.         subttl Int 9h resident filter routine
  103.         page
  104.         ;
  105.         ;
  106.         ; Int 9h resident <Ctrl><Alt> filter
  107.         ;
  108.         ;
  109. filter  proc    far             ;
  110.         push    ax              ;save regs
  111.         push    ds              ;
  112.         mov     ax,0040h        ;point to BIOS data area
  113.         mov     ds,ax           ;with our DS reg
  114.         assume  ds:biosseg
  115.         test    kb_flag,ctl_shift ;is <Ctrl> bit on?
  116.         jz      done            ;if not, nothing to do
  117.         test    kb_flag,alt_shift ;else <Ctrl> bit is on -- is <Alt>?
  118.         jz      done            ;if not, nothing to do
  119.         and     kb_flag,alloff  ;else turn off <Ctrl><Alt> bits
  120. done    label   near
  121.         pop     ds              ;restore regs
  122.         pop     ax              ;
  123.         jmp     dword ptr cs:oldoff ;and jump to old INT 9h handler
  124. filter  endp
  125. last    equ     $+1             ;first byte available for next program
  126.         ;
  127.         ;
  128.         ; Messages
  129.         ;
  130.         ;
  131. errmsg  db      'NOBOOT: Incorrect DOS version.', cr, lf, dollar
  132. okmsg   db      'NOBOOT: <Ctrl><Alt><Del> reset disabled.', cr, lf, dollar
  133.         subttl Installation routine
  134.         page
  135.         ;
  136.         ;
  137.         ; Installation routine
  138.         ;
  139.         ;
  140. install proc    far
  141. start   label   near
  142.         assume  ds:cseg
  143.         mov     ah,30h          ;set code = get DOS version number
  144.         int     21h             ;on to DOS
  145.         cmp     al,0            ;is it pre-DOS 2.0?
  146.         jne     dosok           ;if not, continue
  147.         lea     dx,errmsg       ;else tell user
  148.         mov     ah,9h           ;set code = print string
  149.         int     21h             ;we gotta have DOS 2.x
  150.         int     20h             ;and die gracefully
  151. dosok   label   near
  152.         mov     ax,3509h        ;get seg:off of old
  153.         int     21h             ;INT 9h handler into ES:BX
  154.         mov     oldseg,es       ;and store
  155.         mov     oldoff,bx       ;for later use
  156.         mov     dx,offset filter ;point to our INT 9h filter routine
  157.         mov     ax,2509h        ;set vector for INT 9h
  158.         int     21h             ;on to DOS
  159.         lea     dx,okmsg        ;tell user that we're here
  160.         mov     ah,9h           ;set code = print string
  161.         int     21h             ;on to DOS
  162.         lea     dx,last         ;point after last of resident code
  163.         int     27h             ;terminate and stay resident
  164. install endp
  165. ;
  166. ;
  167. cseg    ends
  168.         end     entry
  169.